package com.squapsource.project_euler;

import java.util.ArrayList;
import java.util.List;

public class Problem3 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		List<Integer> primeFactors = getPrimeFactors(600851475143L);

		System.out.println(primeFactors.toString());
	}

	private static List<Integer> getPrimeFactors(long num) {
		List<Integer> primeFactors = new ArrayList<Integer>();
		
		if (num % 2 == 0)
		{
			primeFactors.add(2);
			num /= 2;
		}
		for (int i = 3; i <= num; i += 2) {
			if (num % i == 0) {

				primeFactors.add(i);
				num /= i;
			}
		}

		return primeFactors;
	}

	public static boolean isPrime(int testNum) {
		for (int i = 2; i <= Math.sqrt(testNum); i++) {
			if (testNum % i == 0) {
				return false;
			}
		}
		return true;
	}

}
